{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport StyleContext from \"../StyleContext\";\nimport useHMR from \"./useHMR\";\nexport default function useClientCache(prefix, keyPath, cacheFn, onCacheRemove) {\n  var _React$useContext = React.useContext(StyleContext),\n    globalCache = _React$useContext.cache;\n  var fullPath = [prefix].concat(_toConsumableArray(keyPath));\n  var HMRUpdate = useHMR(); // Create cache\n\n  React.useMemo(function () {\n    globalCache.update(fullPath, function (prevCache) {\n      var _ref = prevCache || [],\n        _ref2 = _slicedToArray(_ref, 2),\n        _ref2$ = _ref2[0],\n        times = _ref2$ === void 0 ? 0 : _ref2$,\n        cache = _ref2[1]; // HMR should always ignore cache since developer may change it\n\n      var tmpCache = cache;\n      if (process.env.NODE_ENV !== 'production' && cache && HMRUpdate) {\n        onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(tmpCache, HMRUpdate);\n        tmpCache = null;\n      }\n      var mergedCache = tmpCache || cacheFn();\n      return [times + 1, mergedCache];\n    });\n  }, /* eslint-disable react-hooks/exhaustive-deps */\n  [fullPath.join('_')]\n  /* eslint-enable */); // Remove if no need anymore\n\n  React.useEffect(function () {\n    return function () {\n      globalCache.update(fullPath, function (prevCache) {\n        var _ref3 = prevCache || [],\n          _ref4 = _slicedToArray(_ref3, 2),\n          _ref4$ = _ref4[0],\n          times = _ref4$ === void 0 ? 0 : _ref4$,\n          cache = _ref4[1];\n        var nextCount = times - 1;\n        if (nextCount === 0) {\n          onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(cache, false);\n          return null;\n        }\n        return [times - 1, cache];\n      });\n    };\n  }, fullPath);\n  return globalCache.get(fullPath)[1];\n}","map":{"version":3,"names":["_slicedToArray","_toConsumableArray","React","StyleContext","useHMR","useClientCache","prefix","keyPath","cacheFn","onCacheRemove","_React$useContext","useContext","globalCache","cache","fullPath","concat","HMRUpdate","useMemo","update","prevCache","_ref","_ref2","_ref2$","times","tmpCache","process","env","NODE_ENV","mergedCache","join","useEffect","_ref3","_ref4","_ref4$","nextCount","get"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@ant-design/cssinjs/es/hooks/useGlobalCache.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport StyleContext from \"../StyleContext\";\nimport useHMR from \"./useHMR\";\nexport default function useClientCache(prefix, keyPath, cacheFn, onCacheRemove) {\n  var _React$useContext = React.useContext(StyleContext),\n      globalCache = _React$useContext.cache;\n\n  var fullPath = [prefix].concat(_toConsumableArray(keyPath));\n  var HMRUpdate = useHMR(); // Create cache\n\n  React.useMemo(function () {\n    globalCache.update(fullPath, function (prevCache) {\n      var _ref = prevCache || [],\n          _ref2 = _slicedToArray(_ref, 2),\n          _ref2$ = _ref2[0],\n          times = _ref2$ === void 0 ? 0 : _ref2$,\n          cache = _ref2[1]; // HMR should always ignore cache since developer may change it\n\n\n      var tmpCache = cache;\n\n      if (process.env.NODE_ENV !== 'production' && cache && HMRUpdate) {\n        onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(tmpCache, HMRUpdate);\n        tmpCache = null;\n      }\n\n      var mergedCache = tmpCache || cacheFn();\n      return [times + 1, mergedCache];\n    });\n  },\n  /* eslint-disable react-hooks/exhaustive-deps */\n  [fullPath.join('_')]\n  /* eslint-enable */\n  ); // Remove if no need anymore\n\n  React.useEffect(function () {\n    return function () {\n      globalCache.update(fullPath, function (prevCache) {\n        var _ref3 = prevCache || [],\n            _ref4 = _slicedToArray(_ref3, 2),\n            _ref4$ = _ref4[0],\n            times = _ref4$ === void 0 ? 0 : _ref4$,\n            cache = _ref4[1];\n\n        var nextCount = times - 1;\n\n        if (nextCount === 0) {\n          onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(cache, false);\n          return null;\n        }\n\n        return [times - 1, cache];\n      });\n    };\n  }, fullPath);\n  return globalCache.get(fullPath)[1];\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,MAAM,MAAM,UAAU;AAC7B,eAAe,SAASC,cAAc,CAACC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,aAAa,EAAE;EAC9E,IAAIC,iBAAiB,GAAGR,KAAK,CAACS,UAAU,CAACR,YAAY,CAAC;IAClDS,WAAW,GAAGF,iBAAiB,CAACG,KAAK;EAEzC,IAAIC,QAAQ,GAAG,CAACR,MAAM,CAAC,CAACS,MAAM,CAACd,kBAAkB,CAACM,OAAO,CAAC,CAAC;EAC3D,IAAIS,SAAS,GAAGZ,MAAM,EAAE,CAAC,CAAC;;EAE1BF,KAAK,CAACe,OAAO,CAAC,YAAY;IACxBL,WAAW,CAACM,MAAM,CAACJ,QAAQ,EAAE,UAAUK,SAAS,EAAE;MAChD,IAAIC,IAAI,GAAGD,SAAS,IAAI,EAAE;QACtBE,KAAK,GAAGrB,cAAc,CAACoB,IAAI,EAAE,CAAC,CAAC;QAC/BE,MAAM,GAAGD,KAAK,CAAC,CAAC,CAAC;QACjBE,KAAK,GAAGD,MAAM,KAAK,KAAK,CAAC,GAAG,CAAC,GAAGA,MAAM;QACtCT,KAAK,GAAGQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;;MAGtB,IAAIG,QAAQ,GAAGX,KAAK;MAEpB,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAId,KAAK,IAAIG,SAAS,EAAE;QAC/DP,aAAa,KAAK,IAAI,IAAIA,aAAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACe,QAAQ,EAAER,SA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